%GENERATEDMATRIX (脚本) 生成CMT中关于\gamma_r \gamma_d的吸收值和相位变化矩阵
%@since 2022.4.22
%@update: 完成图形基本绘制
%    *参数说明*
%       @return [Phi] 相位变化谱
%       @return [Abp] 吸收谱
%    *使用说明*
%       直接输入脚本名 GENERATEDMATRIX
% ———————————————— POWERED BY YINWEI ————————————————
clear;close all;
m = 0:0.0001:0.02; % gr
n = 0:0.0001:0.02;  % gd
dw = eps; % 无穷小量

% 0+
reflectanceSave = [];

for every = 1:length(m)
    reflectance = (m - n(every) + 1j * dw) ./ (m + n(every) - 1j * dw);
    reflectanceSave = [reflectanceSave; reflectance];
end

% 0-
reflectanceSave1 = [];

for every = 1:length(m)
    reflectance1 = (m - n(every) - 1j * dw) ./ (m + n(every) + 1j * dw);
    reflectanceSave1 = [reflectanceSave1; reflectance1];
end

Phi = -angle(reflectanceSave)+ angle(reflectanceSave1)+2*pi;
Abp = 1 - abs(reflectanceSave).^2;

%% 后续处理
clear m n dw reflectanceSave reflectanceSave1 reflectance reflectance1
contourf(Phi, 10);
figure;
[M, cA] = contourf(Abp, 100);
set(cA, 'LineColor', 'none')


